// 扫描任务相关类型定义

export interface ScanTaskInfo {
  unitTaskId: number;
  lastUnitTaskId?: number;
  appId: string;
  unitId: string;
  gitRepoUrl?: string;
  codeLocation?: string;
  gitBranch?: string;
  gitCommitId?: string;
  artifactoryId?: string;
  saTask: boolean;
  gitTask: boolean;
  apmTask: boolean;
  jarTask: boolean;
  jacgTask: boolean;
  statisticsTask: boolean;
  startTime: string;
  endTime?: string;
  status: 'RUNNING' | 'SUCCESS' | 'SKIPPED' | 'FAILED';
  result?: string;
  triggerType: 'RETRY' | 'SCHEDULE' | 'ARTIFACTORY' | 'MANUAL';
  taskRecords?: TaskRecord[]; // 任务记录列表
}

export interface TaskRecord {
  taskId: number;
  unitScanTaskId: number;
  unitId: string;
  taskType: string;
  taskResult?: string;
  taskStartTime: string;
  taskEndTime?: string;
  taskStatus: string;
}

export interface ScanTaskQueryParams {
  unitId?: string;
  appId?: string;
  statusList?: string[];
  triggerTypeList?: string[];
  startTimeFrom?: string;
  startTimeTo?: string;
  gitBranch?: string;
  pageNum?: number;
  pageSize?: number;
  orderBy?: string;
  orderDirection?: string;
}

export interface PageResult<T> {
  records: T[];
  total: number;
  size: number;
  current: number;
  pages: number;
}

export interface ApiResponse<T> {
  code: number;
  data: T;
  msg?: string;
  message?: string;
}

// 状态颜色映射
export const STATUS_COLORS = {
  RUNNING: '#1890ff',
  SUCCESS: '#52c41a',
  FAILED: '#ff4d4f',
  SKIPPED: '#d9d9d9'
};

// 触发类型标签
export const TRIGGER_TYPE_LABELS = {
  MANUAL: '手动触发',
  SCHEDULE: '定时触发',
  ARTIFACTORY: '制品触发',
  RETRY: '重试'
};

// 任务类型标签
export const TASK_TYPE_LABELS = {
  SA: 'SA分析',
  GIT: 'Git分析',
  APM: 'APM分析',
  JAR: 'JAR分析',
  JACG: 'JACG分析',
  STATISTICS: '统计分析',
  DEPRECATION_ANALYSIS: '废弃分析',
  CHANGE_ANALYSIS: '变更分析'
};